{extend name="base" /}
{block name="content"}
<div class="g-main">
    <div class="m-main-title">
        <div class="m-container-fluid">
            <a href="{:url('index/welcome')}"><i class="icon icon-home"></i>首页</a>
            <span class="icon-angle-right"></span>
            <span>门店管理</span>
            <span class="icon-angle-right"></span>
            <span>门店管理</span>
            <span class="icon-angle-right"></span>
            <span>店员列表</span>
            <a class="u-flush"><i class="icon-repeat"></i></a>
        </div>
    </div>
    <div class="m-main-content">
        <div class="m-container">

            <form class="layui-form">
                <table class="m-table mt-10">
                    <tbody class="datas">
                    <tr>
                        <!--                        <th width="5%" style="text-align: center;">选择</th>-->
                        <th width="5%">ID</th>
                        <th>用户姓名</th>
                        <th>用户手机号</th>
                        <th>操作积分</th>
                        <th>操作类型</th>
                        <th>操作人员(账号/姓名)</th>
                        <th>所属店铺</th>
                        <th>审核状态</th>
                        <th>创建时间</th>
                        <th  width="10%">操作</th>
                    </tr>
                    {foreach name="data" item="v"}
                    <tr>
                        <td>{$v.id}</td>
                        <td>{$v.member_info.username}</td>
                        <td>{$v.member_info.mobile}</td>
                        <td>{$v.points}</td>
                        <td>{$v.type ? "扣除积分" : "新增积分"}</td>
                        <td>{$v.user_info.username}/{$v.user_info.real_name}</td>
                        <td>{$v.user_info.stores_name}</td>
                        <td>{$v.status ? "通过" : "未通过"}</td>
                        <td>{$v.created_at}</td>
                        <td class="m-opt">
                            {if $v.status == 0}
                            <button type="button" data-id="{$v.id}"	class="layui-btn layui-btn-xs">通过</button>
                            <button type="button" data-id="{$v.id}" class="layui-btn layui-btn-xs layui-btn-danger">驳回</button>
                            {else}
                            暂无操作
                            {/if}
                        </td>
                    </tr>
                    {/foreach}

                </table>
            </form>
            {include file="public:page" /}
        </div>
    </div>
</div>
{/block}
{block name="extrajs"}
{include file="laypage" /}
<script>
    $(function(){
        //通过
        $(".layui-btn-xs").click(function () {
            var id = $(this).attr("data-id");
            layer.confirm('确定执行此操作吗?', {icon: 3, title:'提示'}, function(index){
                $.post("/manage/examine/adopt",{
                    id : id
                },function (res) {
                    if (!res.status){
                        dialog.success(res.message,function(){
                            layer.close(index);
                            window.location.reload();
                        })
                    }else{
                        dialog.error(res.message,function(){
                            layer.close(index);
                            window.location.reload();
                        })
                    }
                });
                layer.close(index);
            });
        })
        //驳回
        $(".layui-btn-danger").click(function () {
            var id = $(this).attr("data-id");
            layer.confirm('确定执行此操作吗?', {icon: 3, title:'提示'}, function(index){
                $.post("/manage/examine/reject",{
                    id : id
                },function (res) {
                    if (!res.status){
                        dialog.success(res.message,function(){
                            layer.close(index);
                            window.location.reload();
                        })
                    }else{
                        dialog.error(res.message,function(){
                            layer.close(index);
                            window.location.reload();
                        })
                    }
                });
                layer.close(index);
            });
        })
    })
</script>
{/block}